<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<#include "./../common/header.html"/>

	<link rel="stylesheet" href="${ctx}/static/highlight/styles/default.css">
<script src="${ctx}/static/highlight/highlight.js"></script>

</head>
<body class="easyui-layout">
	<table id="dg" class="easyui-datagrid" title="实时错误列表" style="width:100%;height:98%"
		data-options="
				iconCls: 'icon-ok',
				singleSelect: true,
				url:'${ctx}/exQuery/loadEx',
				toolbar: '#tb',
				pageSize:10,
				pagination:true,
				pageNumber:1,
			">
		<thead>
			<tr>
				<th data-options="field:'method',width:250">ApiMethod</th>
				<th data-options="field:'udid',width:150">设备号</th>
				<th data-options="field:'version',width:50">version</th>
				<th data-options="field:'lvsessionId',width:100">lvsessionId</th>
				<th data-options="field:'channel',width:100">渠道</th>
				<th data-options="field:'queryString',width:200">queryString</th>
				<th data-options="field:'createdTimeStr',width:100">时间</th>
			</tr>
		</thead>
	</table>

	<div id="tb" style="height:auto">
		<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="view_details()">查看详细信息</a>
		时间：<input id="sdate" type="text" class="easyui-datebox" required="required">
		<input id="search" class="easyui-searchbox"   data-options="prompt:'请输入查询内容',menu:'#mm'" style="width:400px"></input> 
				
		<div id="mm" style="width:120px">
			<div data-options="name:'all',iconCls:'icon-ok'">全部</div>
			<div data-options="name:'udid',iconCls:'icon-ok'">设备号</div>
			<div data-options="name:'lvsessionid',iconCls:'icon-ok'">lvsessionid</div>
			<div data-options="name:'method',iconCls:'icon-ok'">method</div>
			<div data-options="name:'ip',iconCls:'icon-ok'">ip</div>
		</div>
	</div>

	<div id="add_dlg" class="easyui-dialog" closed="true" data-options="width:1000,height:500">
		<pre><code class="html"></code></pre>
	</div>

</body>
<script>
$('#search').searchbox({
    searcher:function(value,name){
        //alert(value + "," + name)
        var sdate = $("#sdate").datebox('getValue');
        if(name=='all'){
        	$('#dg').datagrid('load',{udid:"",method:"",ip:"",queryDate:sdate});
        	return;
        }
       
        if(value==""){
        	$.messager.alert({
				title : '提示',
				msg : "请输入查询内容"
			});
        	return;
        }
        
        if(name=="udid"){
        	$('#dg').datagrid('load',{
        		udid: value,queryDate:sdate
        	});
        }
        
        if(name=="lvsessionid"){
        	$('#dg').datagrid('load',{
        		lvsessionid: value,queryDate:sdate
        	});
        }
        
        if(name=="method"){
        	$('#dg').datagrid('load',{
        		method: value,queryDate:sdate
        	});
        }
        
        if(name=="ip"){
        	$('#dg').datagrid('load',{
        		ip: value,queryDate:sdate
        	});
        }
    	
    },
});

function view_details(){
	var row =  $("#dg").datagrid('getSelected');  
	if(row!=null){
		$('#add_dlg').dialog({
			title:'错误详细信息',
			closed: false,
		    cache: false,
			buttons:[{  
	            text:'关闭',  
	            handler:function(){ 
	              $('#add_dlg').dialog('close');
	            }  
	        }],  
	        onOpen:function(){  
	        		$(".html").html(row.exception);
	       	 	//$('#add_contentt_dlg_{$rbtId}').dialog('refresh', '__URL__/toAddInfoForm&rbtId={$rbtId}');   
	        }  
		});
	} else {
		$.messager.alert({
			title : '提示',
			msg : "请选择一行"
		});
	}
	
}
</script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function() {
  $('pre code').each(function(i, block) {
    hljs.highlightBlock(block);
  });
});
</script>
</html>